# 计算score.csv中学生的平均成绩
if __name__ == "__main__":
    fi= open("score.csv", "r",encoding="utf_8_sig")
    fo = open("avg-score.txt", "w",encoding="utf_8_sig")
    ls = []
    x ={}
    sum = 0
    for row in fi:
        ls.append(row.strip("\n").split(","))
    for i in range(len(ls)):
        x[ls[i][0]] = x.get(ls[i][0],0) + float(ls[i][1])
    for key, value in x.items():
        fo.write(key + ":" + str(value/3) + "\n")



